import React from "react";
import PropTypes from 'prop-types';
import { Text, View, StyleSheet, Image, TouchableOpacity, Platform } from "react-native";
import Constant from './Constant'

const isIos = Platform.OS == 'ios';

/**
 * 引入方式：
 * <NoData Desc={this.renderDesc}/>
 * Desc为字符串或者函数
 */
export default NoData = ({ Desc, style, navigation }) => {
    return (
        <View style={[styles.noDataBox, style]}
        >
            <Image style={styles.noDataImg} source={require('source/image/comm/emp_group.png')} />
            {
                Desc && typeof Desc === 'string' ?
                    <Text style={styles.noDataDesc}>{Desc}</Text>
                    :
                    <Desc />
            }


        </View>
    )
}

NoData.propTypes = {
    Desc: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
    style: PropTypes.object
};

NoData.defaultProps = {
    Desc: '',
    style: {}       //追加样式
};

const styles = StyleSheet.create({
    noDataBox: {
        width: '100%',
        height: '100%',
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',

    },
    noDataImg: {
        marginTop:gREM(-30),
        width: gREM(187),
        height: gREM(139),
        marginBottom: gREM(12)
    },
    noDataDesc: {
        textAlign: "center",
        fontSize: gREM(14),
        color: '#999999',
        lineHeight: gREM(22),
        marginStart: 20,
        marginEnd: 20,
    }
})